/**
 * 
 */
package de.cbf.cam.dsa.model.entities.states.stateChanger;

import de.cbf.cam.dsa.model.entities.BattleChar;
import de.cbf.cam.dsa.model.entities.OneNPC;

/**
 * @author Nebelritter
 *
 */
public class StateChangerEnergy extends StateChangerBase {

	public static String PROPERTYNAME = "StateChangerEnergy:";
	
	/**
	 * @uml.property  name="value"
	 */
	private Integer value;
	/**
	 * @uml.property  name="type"
	 */
	private String type;
	
	
	/**
	 * @param weaponType : one of OneEnergy. constants as weaponType of energy to change
	 * @param value : value to change energy by
	 */
	public StateChangerEnergy(String type,Integer value) {		
		this.value 	= value;
		this.type	= type;
	}
	
	@Override
	public void changeStateBattle(BattleChar battleChar) {
		OneNPC npc=battleChar.getCharacter();
		changeState(npc);
	}
	@Override
	public void changeState(OneNPC character) {
		character.changeEnergy(type, value);
	}
	
	/**
	 * @return
	 * @uml.property  name="value"
	 */
	public Integer getValue() {
		return value;
	}
	/**
	 * @param value
	 * @uml.property  name="value"
	 */
	public void setValue(Integer value) {
		this.value = value;
		propertyChangeSupport.firePropertyChange(PROPERTYNAME+"value", null, value);
	}
	/**
	 * @return
	 * @uml.property  name="type"
	 */
	public String getType() {
		return type;
	}
	/**
	 * @param type
	 * @uml.property  name="type"
	 */
	public void setType(String type) {
		this.type = type;
		propertyChangeSupport.firePropertyChange(PROPERTYNAME+"weaponType", null, type);
	}
}
